<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('朗诵统计列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>用户ID：</p>
                                <input type="text" name="kkuid"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="yuwen:audiototal:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('yuwen:audiototal:edit')}]];
        var removeFlag = [[${@permission.hasPermi('yuwen:audiototal:remove')}]];
        var prefix = ctx + "yuwen/audiototal";
        var audioListPrefix = ctx + "yuwen/yuwenaudio/userList"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "朗诵统计",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'id',
                    visible: false
                },
                {
                    field : 'kkuid',
                    title : '用户ID'
                },
                {
                    field : 'user.phone',
                    title : '绑定手机号'
                },
                {
                    field : 'user.uname',
                    title : '昵称'
                },
                {
                    field : 'user.school',
                    title : '学校'
                },
                {
                    field : 'user.gender',
                    title : '性别'
                },
                {
                    field : 'user.uclass',
                    title : '班级'
                },
                {
                    field : 'user.city',
                    title : '城市'
                },
                {
                    field : 'user.grade',
                    title : '年级'
                },
                {
                    field : 'user.registertime',
                    title : '注册时间'
                },
                {
                    field : 'user.thumb',
                    title : '头像地址',
                    formatter: function(value, row, index) {
                    	if(value){
                    		return $.table.imageView(value);
                        }
                    	return ''
                	}
                },
                {
                    field : 'user.major',
                    title : 'major'
                },
                {
                    field : 'user.minor',
                    title : 'minor'
                },
                {
                    field : 'totalAudio', 
                    title : '朗诵总数',
                    sortable: true
                },
                {
                    field : 'totalPlay', 
                    title : '播放量',
                    sortable: true
                },
                {
                    field : 'totalPraise', 
                    title : '点赞量',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="audioList(\'' + row.kkuid + '\',\'' + row.user.uname + '\')"><i class="fa fa-edit"></i>音频列表</a> ');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


        function audioList(kkuid, nickname) {
		    var url = audioListPrefix + "/" + kkuid;
		    $.modal.openTab(nickname + "朗讼作品列表", url);
		}

    </script>
</body>
</html>